package com.hmall.order.web;

import com.hmall.order.pojo.Order;
import com.hmall.order.pojo.OrderDetail;
import com.hmall.order.pojo.RequestParam;
import com.hmall.order.service.IOrderService;
import com.hmall.order.service.impl.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    private IOrderService orderService;

    @GetMapping("{id}")
    public Order queryOrderById(@PathVariable("id") Long orderId) {
        return orderService.getById(orderId);
    }

    //下单
    @PostMapping
    public Long itemOrder(@RequestBody RequestParam requestParam) {
        return orderService.itemOrder(requestParam);
    }
}
